package org.summerframework.core.validation;


import org.summerframework.core.util.CheckUtil;
import org.summerframework.core.validation.constraints.Mobile;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author liaorongbiao
 * @version 1.0
 * @date 2019-06-26 09:31
 **/
public class MobileValidate implements ConstraintValidator<Mobile, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null) {
            return true;
        }

        return CheckUtil.isMobile(value);
    }
}
